import { createWebHistory, createRouter, RouteRecordRaw } from 'vue-router'

// 定义路由（路由懒加载组件）
const routes: RouteRecordRaw[] = [
  { path: '/', name: 'Home', redirect: '/list' }, // 根路径重定向到/list页面
  {
    path: '/list',
    name: 'List',
    component: () => import('../pages/list.vue'),
  },
  {
    path: '/houseDetail/:id',
    name: 'houseDetail',
    component: () => import('../pages/houseDetail.vue'),
  },
]

// 创建路由的实例对象
const router = createRouter({
  history: createWebHistory(),
  routes,
})

// 向外共享路由的实例对象
export default router